#include <gtest/gtest.h>
#include <iostream>
#include <unordered_map>
using namespace std;

//全局事件

std::unordered_map<std::string, std::string> dict;

class MymapEnv : public testing::Environment
{
public:
    virtual void SetUp() override
    {
        std::cout << "测试前:提前准备数据!!\n";
        dict.insert(std::make_pair("Hello", "你好"));
        dict.insert(std::make_pair("good", "很好"));
        dict.insert(std::make_pair("see you", "再见"));
    }
    
    virtual void TearDown() override
    {
        std::cout << "测试结束后:清理数据!!\n";
        dict.clear();
    }
};

TEST(MymapEnv, find_test)
{
    bool ret = dict.count("see you");
    ASSERT_EQ(ret, true);
}
TEST(MymapEnv, size_test)
{
    ASSERT_EQ(dict.size(), 2);
}

int main(int argc, char *argv[])
{
    testing::InitGoogleTest(&argc, argv);
    testing::AddGlobalTestEnvironment(new MymapEnv);

    return RUN_ALL_TESTS();
}